package com.config;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;

public class SessionHander implements HandlerInterceptor{

	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
		Object student = request.getSession().getAttribute("session_student");
		if(student==null) {
			request.setAttribute("msg", "请先登录");
			request.getRequestDispatcher("/login.html").forward(request, response);
			return false;
		}else {
			return true;
		}
	}

}
